import React from "react";
import { Button, Checkbox, Form, Input, message } from "antd";
import "./request.css";
import { useNavigate } from "react-router-dom";
function Request() {
  const onFinish = (values) => {
    console.log("Success:", values);
  };
  const onFinishFailed = (errorInfo) => {
    console.log("Failed:", errorInfo);
  };
  let navigate = useNavigate("");
  const toLogin = () => {
    navigate("/Login");
    message.success("注册成功");
  };
  return (
    <div className="box">
      {" "}
      <div className="form">
        <span>注册</span>
        <Form
          name="basic"
          labelCol={{
            span: 8,
          }}
          wrapperCol={{
            span: 16,
          }}
          style={{
            maxWidth: 600,
          }}
          initialValues={{
            remember: true,
          }}
          onFinish={onFinish}
          onFinishFailed={onFinishFailed}
          autoComplete="off"
        >
          <Form.Item
            name="username"
            rules={[
              {
                required: true,
                message: "请输入用户名!",
              },
            ]}
          >
            <Input />
          </Form.Item>

          <Form.Item
            name="password"
            rules={[
              {
                required: true,
                message: "请输入密码!",
              },
            ]}
          >
            <Input.Password />
          </Form.Item>
          <Form.Item label={null}>
            <Button
              className="btn"
              type="primary"
              htmlType="submit"
              onClick={toLogin}
            >
              注册
            </Button>
          </Form.Item>
        </Form>
      </div>
    </div>
  );
}

export default Request;
